package com.model;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/user")
public class UserController {

	/***
	 * http://localhost:888/user/save
	 * Content-Type:application/json
	 *{
	 *   "name":"Mary",
	 *   "tel":"13211111111",
	 *   "age":30,
	 *   "password":"qwertyuiop"
	 * }
	 */
	@RequestMapping(value = "/save")
	public String save(HttpServletRequest request, @RequestBody User user){
		System.out.println(user.getName());
		return "success";
	}

	@RequestMapping(value = "/list")
	public String list(HttpServletRequest request, @RequestBody User user){
		System.out.println(user.getName());
		return "this is list";
	}
}
